// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import ElementUI from 'element-ui'
// 新添加 避免后期打包样式不同，要放在import App from ./app之前
import 'element-ui/lib/theme-chalk/index.css'
import App from './App'
import router from './router'
import store from './store'

Vue.config.productionTip = false
Vue.prototype.$loading = ElementUI.Loading.service

Vue.use(ElementUI, {size: 'small', zIndex: 3000})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: {App},
  template: '<App/>',
  methods: {
    loadingShow() {
      let loading = this.$loading({
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0,0,0,0.7)',
        target: document.querySelector('body')
      })
      return () => {
        return {
          close: loading.close()
        }
      }
    }
  }
})
